  @extends("home.public.home")

  @section("content")

  <script src="/style/home/js/home/userorder.js"></script>
  <link rel="stylesheet" href="/style/home/css/home/userOrder.css">
    <link rel="stylesheet" href="/style/home/css/zhufu.css">




  <div class="user_right">
    <div class="user_tab">
      <div class="tab_title list_title clearfix">
        <a href="javascript:;" class="tab_btn active" onclick="getData('','','',1)">所有订单</a>
       
          
      </div>
      <div class="tab_body">
        <div class="tab_list" style="display:block;">
          <div class="all_list">
            <div class="all_title">
              <ul class="clearfix">
                <li class="all_title_name">商品名称</li>
                <li class="all_title_unit">单价（元）</li>
                <li class="all_title_number">数量</li>
                <li class="all_title_total">总价（元）</li>
                <li class="all_title_state clearfix">
                  <span class="state_txt">状态</span></li>
                <li class="all_title_opetation">操作</li></ul>
            </div>
            <div id="order_list_data">
              <link rel="icon" href="//m1.lefile.cn/trade/cn/pc/images/b2c_favicon.ico" type="image/x-icon">
              <div class="all_table" xmlns="http://www.w3.org/1999/html">
                <input type="hidden" class="7439518 ot" value="2017-08-24 20:52:08">
                <input type="hidden" class="7439518 pt" value="">
                <input type="hidden" class="7439518 fa" value="1">
                <div class="table_list">
                @foreach($orders as $k=>$v)
                  <div class="table_title clearfix">
                    <a href="javascript:;" title="" class="list_sel clearfix order_checkbox">
                      <input type="checkbox" disabled="disabled"></a>
                       <input type="hidden" value="{{$v['code']}}" id="{{$k}}" />
                    <div title="" class="list_sel clearfix">
                      <i>
                      </i>
                      <span>{{date("Y-m-d H:i:s",$v['time'])}}&nbsp;&nbsp;</span></div>
                    <span class="table_listnum" id="code" >订单编号{{$v['code']}}</span></div>
                  <table cellpadding="0" cellspacing="0" border="0">
                    <tbody>
                      <tr>
                        <td width="669">
                          <div class="table_main">
                            @foreach($v['order'] as $kk=>$vv)
                                {!!$vv!!}
                            @endforeach
                          </div>
                        </td>
                        <td width="111">
                          <span class="table_price">{{$v['price']}}</span>
                          <br>
                          <span class="table_state">在线支付</span></td>
                        <td width="111">
                          <a class="table_state">已取消</a>
                          <br></td>
                        <td width="111">
                          <a href="javascript:;" onclick="szy({{$k}})"  class="table_state1">查看详情</a>

                          <br></td>
                      </tr>
                    </tbody>
                  </table>
                  @endforeach
                  <script>
                      function szy(key){
                        code=$("#"+key).val();

                        $.ajaxSetup({
                                    headers: {
                                        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                                    }
                                 });
                       $.get("/userOrder/12",{"code":code},function(msg)
                        {
                          var code=msg;
                         window.location="/userOrder/orders/"+code;
                        });


                        }
                        function closes()
                        {
                          $("#addAddr").css("display","none");
                        }

                  </script>
                </div>
                <input type="hidden" class="windowLoad" value="7439518">
                <input type="hidden" id="order-status" value="">
                <input type="hidden" id="order-date" value="">
                <input type="hidden" id="search-text" value=""></div>


              <div style="display:none" id="addAddr" class="box-SH box">
        <a class="close"  onclick="closes()" href="javascript:void(0);" >╳</a>
                <table  id="DataTables_Table_1" width="100%" >
                  <thead>
                      <tr role="row">
                          <th>商品名</th>
                <th>商品图片</th>
                <th>购买价格</th>
                <th>购买数量</th>
                <th>小计</th>
                      </tr>
                  </thead>

                  <?php


          ?>
              <tbody role="alert" aria-live="polite" aria-relevant="all">


                  <tr>
                         <td></td>

               <td>
                <img width="200px" src="" alt="">
               </td>

              <td></td>
              <td></td>
              <td></td>

              <?php

               ?>

                      </tr>

                  <tr>
              <td colspan='2'>合计</td>
              <td  align="right">总价：</td>

              <td colspan='2' align="left">商品总数：</td>
              <td  align="left">收货人姓名: </td>
              <td  align="left">收货人地址:</td>
              <td  align="left">收货人电话: </td>
          </tr>
               </tbody>
             </table>
      </div>

              <!-- 页码 -->
              <div class="page_number">
                <ul class="clearfix">
                  <li class="page_btn prev disable">
                    <a href="javascript:;" title="上一页" class="clearfix">
                      <i>
                      </i>
                      <span>上一页</span></a>
                  </li>
                  <li class="page_num active">
                    <a href="javascript:;">1</a></li>
                  <li class="page_btn next disable">
                    <a href="javascript:;" title="下一页" class="clearfix">
                      <i>
                      </i>
                      <span>下一页</span></a>
                  </li>
                  <li class="page_total">共1页</li>
                  <li class="page_goto">到第
                    <input type="text" id="page_goto_index" value="1">页</li>
                  <li class="page_sure">
                    <input type="button" onclick="page_sure()" style="cursor: pointer;" value="确定"></li>
                </ul>
              </div>

              <script>User.logisDetail();

                //下载电子票
                function getinvoiceurl(orderno, passkey) {
                  jQuery.ajax({
                    url: '/center/getinvoiceurl.jhtm',
                    data: 'orderno=' + orderno + '&passkey=' + passkey,
                    type: 'get',
                    async: false,
                    success: function(data) {
                      if (data != null && data.rc == "0") {
                        window.location.href = data.msg;
                      } else {
                        alert(data.msg);
                      }
                    }
                  });
                }
                //订单追踪
                function getTrackInfo(ordno, passKey) {
                  var ordertime = $('.' + ordno).eq(0).val(); //下单时间
                  var paytime = $('.' + ordno).eq(1).val(); //支付时间
                  var fatype = $('.' + ordno).eq(2).val(); //fa类型 0、3直营 1、2、4非直营
                  jQuery.ajax({
                    type: 'post',
                    url: '/center/getOrderTrackInfo.jhtm',
                    data: 'orderNo=' + ordno + '&type=1&orderTime=' + ordertime + '&payTime=' + paytime + '&faType=' + fatype + '&merchantId=1' + '&passKey=' + passKey,
                    async: false,
                    success: function(data) {
                      if (data != null) {
                        $("#" + ordno).html(data);
                      } else {
                        $("#logis_list" + ordno).html("暂无物流信息!");
                      }
                    }
                  });
                }

                window.onload = timedMsg;

                var t;
                function timedMsg() {
                  $(".windowLoad").each(function() {
                    var orderNo = $(this).val();
                    var c = $(".time_second" + orderNo).val();
                    timeCc(orderNo, c)
                  });
                }

                function timeCc(orderNo, c) {
                  var orderno = orderNo;

                  $(".daojishi_name" + orderno).text($(".time_second_name" + orderno).val())

                  $(".daojishi" + orderno).text(timeStamp(c));
                  var time_second_biaoshi = $(".time_second_biaoshi" + orderno).val();

                  if (c == 0) {
                    clearTimeout(t);
                    if (time_second_biaoshi == 0) {
                      window.location.reload(); //为跳转地址
                    } else if (time_second_biaoshi == 1) {
                      window.location.reload(); //为跳转地址
                    } else if (time_second_biaoshi == 2) {
                      window.location.reload(); //为跳转地址
                    } else if (time_second_biaoshi == 3) {

  }
                  } else {
                    c--;
                    t = setTimeout('timeCc(' + orderNo + ',' + c + ')', 1000);
                  }

                }

                function timeStamp(second_time) {

                  var time = parseInt(second_time) + "秒";

                  if (parseInt(second_time) > 60) {

                    var second = parseInt(second_time) % 60;
                    var min = parseInt(second_time / 60);
                    time = min + "分" + second + "秒";

                    if (min > 60) {
                      min = parseInt(second_time / 60) % 60;
                      var hour = parseInt(parseInt(second_time / 60) / 60);
                      time = hour + "小时" + min + "分" + second + "秒";

                      if (hour > 24) {
                        hour = parseInt(parseInt(second_time / 60) / 60) % 24;
                        var day = parseInt(parseInt(parseInt(second_time / 60) / 60) / 24);
                        time = day + "天" + hour + "小时" + min + "分" + second + "秒";
                      }
                    }
                  }

                  return time;
                }</script>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  @endsection